﻿function goback(hardid){
    if (window.confirm('你确定要退回吗？')) {
        $.ajax({
            type: "post",
            url: "/ashx/Casc.ashx",
            data: {
                iotype: 'goback'
                   , hardid: hardid
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                alert(XmlHttpRequest.status);
                alert("提交失败！")
            },
            success: function (msg) {
                location.reload();
            }
        });
        return true;
    } else {
        //alert("取消");
        return false;
    }
}

function cancel() {
    location.reload();
}

//初检弹出1
function gocheck(hardid) {
    $("#hidHardid").val(hardid);
 
    //取值
    $.ajax({
        type: "post",
        url: "/ashx/Casc.ashx",
        data: {
            iotype: 'm'
                   , mid: hardid
        },
        error: function (XmlHttpRequest, textStatus, errorThrown) {
            alert(XmlHttpRequest.status);
            alert("提交失败！")
        },
        success: function (msg) {
            //值显示
            var o = eval('(' + msg + ')');
            $("#lblno").html(o.hardwareno);
            $("#lblbcity").html(o.bcity);
            $("#lblgcity").html(o.gcity);
            $("#lblcjo").html(o.cjono);
            $("#lblload").html(o.cjono);
            $("#lblcumname").html(o.cumname);
            $("#lblman").html(o.sealman);
            $("#lblcjoremark").html(o.cjoremark);
            $("#lblcolldate").html(o.wrldate);
            $("#lblcount").html(o.boxcount);
            $("#txtinitremark").val(o.initremark);
            var myDate = new Date();
            $("#lblgodate").html(myDate.toLocaleDateString());
            //弹出框
            $("#tabreord").dialog({
                width: 400,
                height: 300,
                resizable: false,
                position: 'center',
                title: '初检送检',
                modal: true
            });
        }
    });


}

//初检弹出提交
function gocheckSubmit() {
    var checkstatus = $("#gotype").val();
 
    if (checkstatus == '0') {
        alert("请选择是否硬件测试");
        return;
    } 
    else {

        var myDate = new Date();
        var idate = myDate.toLocaleDateString();
        //弹出框
        $.ajax({
            type: "post",
            url: "/ashx/Casc.ashx",
            data: {
                iotype: "hard"
               , hardid: $("#hidHardid").val()
               , initremark: $("#txtinitremark").val()
               , initdate: idate
               , step1: checkstatus
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                alert(XmlHttpRequest.status);
                alert("提交失败！")
            },
            success: function (msg) {
                alert("已经送检");
                location.reload();
            }
        });
    }
    

}

$(document).ready(function () {

    $("#rdoinit,#rdohard").click(function () {
        if ($(this).attr('id') == 'rdoinit') {
            $("#gotype").val("2");  //待硬件检测
        }
        else if ($(this).attr('id') == 'rdohard') {
            $("#gotype").val("3");  //直接理货备注
        }
        
    });

    $('#tab').dataTable({ "oLanguage":
                 { "sUrl": "/jquery/jquery.dataTable.cn.txt" },
        "bJQueryUI": true,
        "sPaginationType": "full_numbers",
        'bPaginate': true,
        "bProcessing": true,
        "iDisplayLength": 20,
        "bSort": true,
        "aaSorting": [[0, "desc"]]
    });

    $("#tabreord").hide();

  



});
